/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.hl7.datatypes.r2.foundation;

import java.util.Collection;
import javax.persistence.ElementCollection;
import javax.persistence.Embeddable;
import org.hl7.datatypes.r2.quantities.INT;

/**
 *
 * @author Obama
 */
@Embeddable
public class COLL<T> extends ANY {
    
    @ElementCollection
    private Collection<T> collValue;

    public COLL(Collection<T> values) {
        this.collValue = values;
    }

    public COLL() {
    }

    public BL isEmpty() {
        return collValue==null?null:new BL(collValue.isEmpty());
    }

    public BL notEmpty() {
        return collValue == null ? null : new BL(!collValue.isEmpty());
    }

    public INT count() {
        return collValue == null ? null :new INT(collValue.size()) ;
    }

    public BL contains(T item) {
        if(collValue==null|| collValue.isEmpty()){
            return null;
        }else{
            return new BL(collValue.contains(item));
        }
    }

    public Collection<T> getCollValue() {
        return collValue;
    }

    public void setCollValue(Collection<T> collValue) {
        this.collValue = collValue;
    }

}
